#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
char str[40005];
char shor[205];
int main(){
	int n=0;
	//freopen("P1320_2.in","r",stdin);;
	while(cin>>shor){
		strcat(str,shor);
		n++;
	}
	cout<<n<<" ";
	int i=0;
	int a=0,b=0;
	while(str[i]!=0){
		a=0;
		while(str[i++]=='0'){
			a++;
		}
		if(str[i]==0&&a==0) break;
		cout<<a<<" ";
		b=0;
		i--;
		while(str[i++]=='1'){
			b++;
		}
		if(str[i]==0&&b==0)break;
		cout<<b<<" ";
		i--;
	}

	return 0;
}
